package main

// 假设有很多个

// 1 2 3 1
// 4 5 6

func distributeCandies(candies int, num_people int) []int {
	if num_people == 0 {
		return []int{}
	}
	list := make([]int, num_people)
	tmp := 1
	for candies > 0 {
		for index := range list {
			if tmp > candies {
				// 把剩下的给这个人
				list[index] += candies
				candies = 0
				break
			}
			list[index] += tmp
			candies -= tmp
			tmp++
		}
	}
	return list
}

func main() {
	distributeCandies(10, 3)
}
